package us.codecraft.webmagic;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class SeleniumT {
    @Test
    public void testSelenium(){
        System.getProperties().setProperty("webdriver.chrome.driver", "D:\\Chrome\\chromedriver.exe");
        WebDriver driver=new ChromeDriver();
        driver.get("https://www.baidu.com");
        System.out.println("The testing page title is: "+driver.getTitle());
        driver.quit();
    }

    @Test
    public void huabanSelenium() {
        System.getProperties().setProperty("webdriver.chrome.driver", "D:\\Chrome\\chromedriver.exe");
        WebDriver webDriver = new ChromeDriver();
        webDriver.get("http://huaban.com/");
        WebElement webElement = webDriver.findElement(By.xpath("/html"));
        System.out.println(webElement.getAttribute("outerHTML"));
        webDriver.close();
    }
}
